<?php defined( '_VALID_MOS' ) or die( 'Direct Access to this location is not allowed.' );

/* JoomLeague League Management and Prediction Game for Joomla!
 * Copyright (C) 2007  Robert Moss
 *  
 * Homepage: http://www.joomleague.de
 * Support: htt://www.joomleague.de/forum/
 * 
 * This file is part of JoomLeague.
 *  
 * JoomLeague is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License
 * as published by the Free Software Foundation; either version 2
 * of the License, or (at your option) any later version.
 *
 * Please note that the GPL states that any headers in files and
 * Copyright notices as well as credits in headers, source files
 * and output (screens, prints, etc.) can not be removed.
 * You can extend them with your own credits, though...
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 * 
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
 *
 * The "GNU General Public License" (GPL) is available at
 * http://www.gnu.org/copyleft/gpl.html.
*/ 

?>

<!-- Header with Project Name-->
<?php if ($showPlayer_config['show_project_heading'] == "1" OR $overall_config['show_project_heading'] == "1") { ?>
<div class="componentheading" <?php if ($showPlayer_config['show_print_button'] == "1" OR $overall_config['show_print_button'] == "1") echo 'style="float:left;"';?>><?php echo HTML_joomleague::showTitle($project, $overall_config['project_heading_type']); ?></div>
<!-- Druckfunktion -->
<?php if ($showPlayer_config['show_print_button'] == "1" OR $overall_config['show_print_button'] == "1") {
HTML_joomleague::PrintIcon( $row, $params, false, '' );
};?>
<!-- Druckfunktion Ende -->
<?php } ?>
<!-- Header END -->

<!-- Bereichsüberschrift z.B Tabelle, Tippabgabe usw. bei Bedarf mit Drucksymbol -->
<table width="100%" class="contentpaneopen">
	<tr>
		<td class="contentheading"><?php echo sprintf ('%s %s' ,$row->firstname,$row->lastname);?>
    	<?php if($row->injury > 0 && $row->injury_end > $project->current_round){
        echo sprintf("<img src=\"$mosConfig_live_site/components/com_joomleague/frontend/default/images/injured.gif\" alt=\"\">");
        echo "</img>";
              }?>
    	<?php if($row->suspension > 0 && $row->suspension_end > $project->current_round){
        echo sprintf("<img src=\"$mosConfig_live_site/components/com_joomleague/frontend/default/images/suspension.gif\" alt=\"\">");
        echo "</img>";
              }?>              
    </td>
	</tr>
</table>
<!-- Bereichsüberschrift Ende -->
<br />
  
<table width="96%" align="center" border="0" cellpadding="3" cellspacing="0">
	<tr class="sectiontableheader">
	 <td colspan="2"><?php echo _JL_PAGE_TITLE_PLAYER ;?></td>
	</tr>
<tr><td>&nbsp;</td></tr>
	<tr>
<?php if ($showPlayer_config['show_player_photo']==1) {
$picture = ($row->picture!=''&&!is_null($row->picture)&&file_exists($mosConfig_absolute_path.'/'.$row->picture)) ? $row->picture : $row->default_picture;
if ($picture!=''&&!is_null($picture)&&file_exists($mosConfig_absolute_path.'/'.$picture)) {
?>
      <td width="50%" align="center" valign="middle">
        <?php echo sprintf("<img src=\"$mosConfig_live_site/%s\" alt=\"%s\" title=\"%s\" />",$picture,$row->lastname,$row->lastname);?>&nbsp;
      </td>
<?php } 
  }?>      
      <td width="50%" align="center" valign="top">
        <table width="100%" border="0">
          <tr>
            <td width="40%"><b><?php echo _JL_PLAYER_NAME;?></b></td>
            <td width="60%" align="left"><?php echo sprintf("%s %s",$row->firstname,$row->lastname); ?>
            <?php
      $query="SELECT * FROM #__joomleague_countries WHERE countries_id = ".$row->nation;
      $database->setQuery($query);
			if ($countries = $database->loadObjectList()) {
      if (file_exists($mosConfig_absolute_path."/images/joomleague/flags/".strtolower($countries[0]->countries_iso_code_2).".png")) {
	echo "<img src=\"".$mosConfig_live_site."/images/joomleague/flags/".strtolower($countries[0]->countries_iso_code_2).".png\" alt=\"".$country[$countries[0]->countries_iso_code_3]."\" title=\"".$country[$countries[0]->countries_iso_code_3]."\" hspace=\"2\" /> ";
} else echo " [".$countries[0]->countries_iso_code_3."]";}
     ?>
            
            </td>
          </tr>
<?php if($row->birthday != '0000-00-00'){ ?>
          <tr>
            <td><b><?php echo _JL_PLAYER_BIRTHDAY;?></b></td>
            <td align="left"><?php printf("%s (%s)", mbiFormatDate($row->birthday, _JL_DAYDATE), getAge($row->birthday)); ?></td>
          </tr>
<?php } ?>
<?php if($row->position != ""){ ?>
          <tr>
            <td><b><?php echo _JL_PLAYER_POSITION;?></b></td>
            <td align="left"><?php echo $row->position;?></td>
          </tr>
<?php } ?>
<?php if($row->position_number > 0){ ?>
          <tr>
            <td><b><?php echo _JL_PLAYER_NUMBER;?></b></td>
            <td align="left">
        <img src="<?php echo $mosConfig_live_site."/components/com_joomleague/frontend/".$project->template;?>/images/shirt.php?text=<?php echo ($row->position_number!=0) ? $row->position_number : '';?>" alt="<?php echo $row->position_number;?>" title="<?php echo $row->position_number;?>" />    
            </td>
          </tr>
<?php } ?>
<?php if($row->height > 0){ ?>
          <tr>
            <td><b><?php echo _JL_PLAYER_HEIGHT;?></b></td>
            <td align="left"><?php printf("%s cm",$row->height); ?></td>
          </tr>
<?php } ?>
<?php if($row->weight > 0){ ?>
          <tr>
            <td><b><?php echo _JL_PLAYER_WEIGHT;?></b></td>
            <td align="left"><?php printf("%s kg",$row->weight);?></td>
          </tr>
<tr><td>&nbsp;</td></tr>          
<?php } ?>
<?php if($row->injury > 0 && $row->injury_end > $project->current_round){ ?>
          <tr>
            <td style="color: red"><b><?php echo _JL_PLAYER_INJURY_END;?></b></td>
            <td align="left"><?php printf("%s. %s",$row->injury_end, _JL_MATCHDAY); ?></td>
          </tr>
          <tr>
            <td nowrap="nowrap"><b><?php echo _JL_PLAYER_INJURY_TYPE;?></b></td>
            <td align="left"><?php printf("%s", htmlspecialchars($row->injury_detail)); ?></td>
          </tr>          
<?php } ?>
<?php if($row->suspension > 0 && $row->suspension_end > $project->current_round){ ?>
          <tr>
            <td style="color: red"><b><?php echo _JL_PLAYER_SUSPENSION_END;?></b></td>
            <td align="left"><?php printf("%s. %s",$row->suspension_end, _JL_MATCHDAY); ?></td>
          </tr>
          <tr>
            <td nowrap="nowrap"><b><?php echo _JL_PLAYER_SUSPENSION_REASON;?></b></td>
            <td align="left"><?php printf("%s",htmlspecialchars($row->suspension_detail)); ?></td>
          </tr>          
<?php } ?>
        </table>
      </td>
    </tr>

    </table>
        <br /><br />
<?php if ($showPlayer_config['show_player_description']==1 && $row->description !='') {;?>
<table width="96%" align="center" border="0" cellpadding="3" cellspacing="0">
	<tr class="sectiontableheader">
		<td><?php echo _JL_ADMIN_EDIT_FORM_PLAYERTOOL_TITLE2;?></td>
	</tr>
<tr><td>&nbsp;</td></tr>	
	<tr>
		<td>
			<?php echo $row->description;?>
		</td>
	</tr>
</table>
<br /><br />
<?php };?>

<?php if ($showPlayer_config['show_player_statistic']==1) {;?>
<table width="96%" align="center" border="0" cellpadding="3" cellspacing="0">
	<tr class="sectiontableheader">
		<td colspan="3"><?php echo _JL_PLAYER_STATS;?></td>
	</tr>

<?php
// neu Gucky 2007/02/14 modified
      $k = 1;
      if (count($eventtypes)>0) {
      foreach($eventtypes as $eventtype){
      	$k = 1 - $k;
        $class = ($k == 1)? 'sectiontableentry1' : 'sectiontableentry2';
      	$scores=$project->getPlayerEvents($rows[0]->player_id, $eventtype->id);
//      	if ($scores>0) {
?>	<tr>
			<td width="20" align="center" class="<?=$class;?>">
				<img src="<?php echo $mosConfig_live_site?>/components/com_joomleague/frontend/default/images/event_icons/<?=$eventtype->icon;?>" alt="<?=$eventtype->name;?>" title="<?=$eventtype->name;?>" />
			</td>
			<td class="<?=$class;?>">
				<b><?php echo $eventtype->name;?>:</b>
			</td>
      <td class="<?php echo $class;?>">
      	<b><?php echo ($scores>0)?$scores:'-';?></b>
      </td>
    </tr>
<?php 
// neu Gucky 2007/02/14 modified ends
// 		}
	}
}
?>
	</table>
<?php };?>
	
<!-- Print Button START -->
<?php if ($showPlayer_config['show_back_button'] > 0 OR $overall_config['show_back_button'] > 0) {;?>
<?php if ($showPlayer_config['show_back_button'] == "1" OR $overall_config['show_back_button'] == "1") echo '<div align="left">'; else echo '<div align="right">';?>
<?php
$params = & new mosParameters( '' );
$params->def( 'back_button', true );
$params->def( 'popup', false );
mosHTML::BackButton( $params );
?></div> 
<?php };?>
<!-- Print Button END -->  
